import java.util.Scanner;
interface Coffee {
    abstract String getName();
}
class Americano implements Coffee {
    @Override
    public String getName() {
        return "是Americano";
    }
}
class Cappuccino implements Coffee {
    @Override
    public String getName() {
        return "是Cappuccino";
    }
}
class Latte implements Coffee {
    @Override
    public String getName() {
        return "是Latte";
    }
}

class CoffeeFactory {
    public static Coffee creatInstance(String name) {
        if("Americano".equalsIgnoreCase(name))
            return new Americano();
        else if("Cappuccino".equalsIgnoreCase(name))
            return new Cappuccino();
        else if("Latte".equalsIgnoreCase(name))
            return new Latte();
        else
            return null;
    }
}

public class Test_2 {
    public static void main(String[] args) {
        System.out.println("你最喜欢的咖啡是什么->");
        String name;
        Scanner scan = new Scanner(System.in);
        name = scan.next();

        Coffee C = CoffeeFactory.creatInstance(name);
        if(C == null)
            System.out.println("没有这种咖啡");
        else
            System.out.println("你最喜欢的"+C.getName());
    }
}
